<template>
  <tabs class="ticket-intro" scrollY :tabsList="[{label: '信息指南'}, {label: '景区政策'}]" >
    <tabItem :index="0">
      <view class="label-title">
        <img src="/static/info.png" alt="">
        <view class="title">信息指南</view>
      </view>

      <template v-for="(item, index) in introductionConfig.intro">
        <view v-if="product[item.key]" :key="index" class="intro-item">
          <view class="title">{{item.title}}</view>
          <text class="content">{{item.prefix || ''}}{{product[item.key]}}</text>
        </view>
      </template>
      
    </tabItem>
    <tabItem :index="1">
      <view class="label-title">
        <img src="/static/view.png" alt="">
        <view class="title">景区政策</view>
      </view>
      <template v-for="(item, index) in introductionConfig.policy">
        <view v-if="product[item.key]" :key="index" class="intro-item">
          <view class="title">{{item.title}}</view>
          <text class="content">{{item.prefix || ''}}{{product[item.key]}}</text>
        </view>
      </template>
    </tabItem>
  </tabs>
</template>
<script>

import tabs from '@/components/business/tabs'
import tabItem from '@/components/business/tab-item'

export default {
  name: 'ticket-intro',

  props: {
    product: {
      type: Object,
      required: true
    }
  },

  data() {
    return {
      introductionConfig: {
        intro: [
          {title: '介绍', key: 'intro'},
          {title: '建议游玩时长', key: 'playTime'},
          {title: '交通攻略', key: 'trafficInfo'},
          {title: '开放时间', key: 'openTime'},
        ],
        policy: [
          {title: '优待政策', key: 'crowdPolicies'},
          {title: '联系方式', key: 'url', prefix: '官网：'},
          {title: '联系方式', key: 'tel', prefix: '电话：'},
        ]
      }
    }
  },

  components: { tabs, tabItem },
}
</script>
<style lang="less">
.ticket-intro {
  .label-title {
    @height: 50rpx;

    .flex;
    .flex-middle;

    img {
      width: @height;
      height: @height;
    }

    .title {
      height: @height;
      line-height: @height;
      margin-left: 14rpx;

      font-size: 36rpx;
      font-weight: bold;
    }
  }

  .intro-item {
    line-height: 40rpx;
    margin: 40rpx 0;

    .title {
      font-size: 30rpx;
      font-weight: bold;
      margin-bottom: 10rpx;
    }

    .content {
      font-size: 28rpx;
      text-align: justify;
    }
  }
}
</style>